-
Notifications
You must be signed in to change notification settings - Fork 618
feat(core:domain): Migrate to KMP #2350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core:domain): Migrate to KMP #2350
Conversation
core/domain/src/commonMain/kotlin/com/mifos/core/domain/useCases/ActivateGroupUseCase.kt
Outdated
Show resolved
Hide resolved
# Conflicts: # core/domain/src/commonMain/kotlin/com/mifos/core/domain/useCases/DeleteClientAddressPinpointUseCase.kt # core/domain/src/main/java/com/mifos/core/domain/useCases/GetAllLoanUseCase.kt
core/domain/src/commonMain/kotlin/com/mifos/core/domain/useCases/GetCenterDetailsUseCase.kt
Outdated
Show resolved
Hide resolved
# Conflicts: # core/domain/src/androidMain/kotlin/com/mifos/core/domain/useCases/GroupsListPagingDataSource.android.kt
...rc/commonMain/kotlin/com/mifos/core/domain/useCases/LoadSavingsAccountsAndTemplateUseCase.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I can see these most of the UseCase classes are useless since it doesn't do any Job rather than calling the repository method itself, which we can directly so by accessing the repository in ViewModel. for e.g take a look into this class.
class ActivateSavingsUseCase(
private val repository: SavingsAccountActivateRepository
) {
operator fun invoke(
savingsAccountId: Int,
request: HashMap<String, String>
): Flow<DataState<GenericResponse>> =
repository.activateSavings(savingsAccountId, request)
}
does it do any extra work rather than calling the method no so it's just useless and anti-pattern and can delete this class and remove overhead.
so my suggestion is to Keep Use Case classes that perform meaningful transformations, business logic, or complex operations. Remove Use Case classes that merely act as pass-through wrappers around repository methods without adding any additional value or processing logic.
Retain Use Cases that:
- Implement complex business rules
- Perform data filtering, sorting, or transformation
- Combine data from multiple repositories
- Add validation or preprocessing steps
- Encapsulate intricate domain-specific logic
Remove Use Cases that:
- Directly delegate to repository methods without any additional processing
- Offer no extra functionality beyond repository method invocation
- Create unnecessary abstraction layers without adding value
@niyajali Thanks for your detailed review. We have a separate ticket for getting rid of useCases which are doing nothing but forwarding a flow. Here is the link to the Jira ticket: https://mifosforge.jira.com/browse/MIFOSAC-440 |
Fixes - Jira-#410
Didn't create a Jira ticket, click here to create new.
Please Add Screenshots If there are any UI changes.
Please make sure these boxes are checked before submitting your pull request - thanks!
Run the static analysis check
./gradlew check
orci-prepush.sh
to make sure you didn't break anythingIf you have multiple commits please combine them into one commit by squashing them.